import java.util.Arrays;
import java.util.Scanner;

public class Test {

    public static void main1(String[] args) {
        String p1 = "abc";
        String p2 = "123";
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入你的用户名：");
        String s = sc.nextLine();
        System.out.println("请输入你的密码：");
        String a = sc.nextLine();

        if (!p1.equals(s)) {
            throw new NameWorning("用户名错误");
        } else if (!p2.equals(a)) {
            throw new WorldWorning("密码错误");
        }
        System.out.println("登陆成功");
    }

    public static void main(String[] args) {
        int[] nums = {1, 2, 3, 4, 5, 6, 7};
        Solution a = new Solution();
        a.rotate(nums, 3);
    }
}

class Solution {
    public void rotate(int[] nums, int k) {
        for (int i = 0; i < k; i++) {
            int tmp = nums[nums.length - 1];
            for (int i1 = 1; i1 < nums.length; i1++) {
                nums[nums.length - i1] = nums[nums.length - 1 - i1];
            }
            nums[0] = tmp;
        }
        System.out.println(Arrays.toString(nums));
    }
}